<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    
    <style>
        .nav img {
            width: 50px;
            height: 50px;
            border-radius: 50%;
        }

        .nav a {
            color: gray;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="nav">
        <img src="https://haowallpaper.com/link/common/file/previewFileImg/16733802134949248" alt="图片加载失败...">
        <span>我的博客系统</span>
        <a href="./blog-list.html">主页</a>
        <a href="./blog-editor.html">写博客</a>
        <!-- 这里是需要请求后端，清除session信息，置为未登录态 -->
        <a href="https://www.baidu.com/">注销</a>

        <div class="container">
            <p>登录</p>
            <span>用户名</span> <input type="text" name="" id="username"> <br>
            <span>密码</span> <input type="password" name="" id="password"> <br>
            <input type="button" value="登录" onclick="login()">
        </div>
    </div>

    <script>
        // 登录方法
        function login() {
            // 获取输入框的数据，并判断是否为空，接着进行数据验证
            let username = document.querySelector('#username').value;
            let password = document.querySelector('#password').value;
            // console.log(username);
            // console.log(password);
            if (username == '' || password == '') {
                alert('用户名和密码不能为空!');
                return;
            }
            if (username == '张三' && password == '123456') {
                alert('登录成功!');
                location.href = './blog-list';
            } else {
                alert('用户名或密码错误!');
            }
        }
    </script>
</body>
</html>